//
// A factory to create a GUI video renderer.

#ifndef TALK_MEDIA_DEVICES_VIDEORENDERERFACTORY_H_
#define TALK_MEDIA_DEVICES_VIDEORENDERERFACTORY_H_

#include "media/videorenderer.h"
#if defined(LINUX) && defined(HAVE_GTK)
#include "media/gtkvideorenderer.h"
#elif defined(OSX) && !defined(CARBON_DEPRECATED)
#include "media/carbonvideorenderer.h"
#elif defined(WIN32)
#include "media/gdivideorenderer.h"
#endif

namespace cricket {

	class VideoRendererFactory {
	public:
		static VideoRenderer* CreateGuiVideoRenderer(int x, int y) {
#if defined(LINUX) && defined(HAVE_GTK)
			return new GtkVideoRenderer(x, y);
#elif defined(OSX) && !defined(CARBON_DEPRECATED)
			CarbonVideoRenderer* renderer = new CarbonVideoRenderer(x, y);
			// Needs to be initialized on the main thread.
			if (renderer->Initialize()) {
				return renderer;
			} else {
				delete renderer;
				return NULL;
			}
#elif defined(WIN32)
			return new GdiVideoRenderer(x, y);
#else
			return NULL;
#endif
		}
	};

}  // namespace cricket

#endif  // TALK_MEDIA_DEVICES_VIDEORENDERERFACTORY_H_
